function init() {
    schedule()
}

function schedule() {
    em.setProperty("docked", "true");
    em.setProperty("entry", "true");
    em.setProperty("haveBalrog", "false");
    if (em.getMapFactoryMap(200000111).getCharactersSize() > 0 || em.getMapFactoryMap(104020110).getCharactersSize() > 0) {
        var a = em.getChannelServer().getPlayerStorage().getAllCharacters();
        a = a.iterator();
        while (a.hasNext()) {
            var b = a.next();
            b.getAPI().addPopupSay(1540805, 2500, "#face18#[亲,等急了吧, 船来了,快上船吧!]", "", 0);
            b.getAPI().fieldEffect_PlayFieldSound("Sound/Object.img/Whistle", 100)
        }
    }
    em.schedule("stopentry", 30000);
    em.schedule("takeoff", 60000);
    em.getMapFactory().getMap(200090000).killAllMonsters(false);
    em.getMapFactory().getMap(200090010).killAllMonsters(false)
}

function stopentry() {
    em.setProperty("entry", "false");
    em.getMapFactory().getMap(200090011).resetReactors();
    em.getMapFactory().getMap(200090001).resetReactors()
}

function takeoff() {
    em.warpAllPlayer(200000112, 200090000);
    em.warpAllPlayer(104020111, 200090010);
    em.broadcastShip(200000111, 3);
    em.broadcastShip(104020110, 3);
    em.setProperty("docked", "false");
    em.setProperty("docked", "false");
    em.schedule("spawnMons", 30000);
    em.schedule("warpPlayer", 100000)
}

function warpPlayer() {
    em.warpAllPlayer(921170001, 200000100);
    em.warpAllPlayer(200090011, 200000100);
    em.warpAllPlayer(200090000, 104020110);
    em.warpAllPlayer(200090001, 104020110);
    em.broadcastShip(200000111, 1);
    em.broadcastShip(104020110, 1);
    em.getMapFactory().getMap(921170001).killAllMonsters(false);
    em.getMapFactory().getMap(200090000).killAllMonsters(false);
    em.setProperty("docked", "true");
    em.setProperty("entry", "true");
    em.setProperty("haveBalrog", "false");
    schedule()
}

function spawnMons() {
    em.warpAllPlayer(200090010, 921170001);
    if (Math.floor(Math.random() * 10) < 10) {
        var d = em.getMapFactory().getMap(921170001);
        var b = new java.awt.Point(-538, 143);
        d.spawnMonsterOnGroundBelow(em.getMonster(8150000), b);
        d.spawnMonsterOnGroundBelow(em.getMonster(8150000), b);
        d.spawnMonsterOnGroundBelow(em.getMonster(8150000), b);
        var c = em.getMapFactory().getMap(200090000);
        var a = new java.awt.Point(339, 148);
        c.spawnMonsterOnGroundBelow(em.getMonster(8150000), a);
        c.spawnMonsterOnGroundBelow(em.getMonster(8150000), a);
        c.spawnMonsterOnGroundBelow(em.getMonster(8150000), a);
        em.setProperty("haveBalrog", "true");
        em.broadcastShip(200090000, 1034);
        em.broadcastShip(921170001, 1034)
    }
};